{extend name="_container/add"}

{block name="content"}
<div class="layui-form-item">
    <label class="layui-form-label required">控制器类名称<span></span></label>
    <div class="layui-input-inline">
        <input type="text" placeholder="" name="name"  class="layui-input modelform_name"
               lay-verify="required"     value="" style="" autocomplete="off">
        <div class="description"></div>
    </div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label required">控制器中文名称<span></span></label>
    <div class="layui-input-inline">
        <input type="text" placeholder="" name="comment"  class="layui-input modelform_name"
               lay-verify="required"     value="" style="" autocomplete="off">
        <div class="description"></div>
    </div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>

<input type="hidden" name="app_id" value="{:input('app_id')}">
{/block}
{block name="js"}
<script>
    function save_form3(obj) {
        save_form2(obj);
        return false;
    }
</script>



<script>
    let type_map =  {:json_encode($types)};
    $('#type').change(
        () => {
            let type = $("#type").val();
           if(type === 'hasManyThrough' || type === 'hasOneThrough') {
               $("#middle_wrapper").show();
               $('#relation').html('（' + type_map[type] + '）')
           }else{
               if(type){
                   $('#relation').html('（' + type_map[type] + '）')
               } else {
                   $('#relation').html('')
               }

               $("#middle_wrapper").hide();
           }

        }
    )
</script>
{/block}

{/extend}
